#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#define REP(i,n) for(int i=0;i<int(n);++i)

using namespace std;

int n;
int k[3],t[3];
int reachTime[100100];

void slove()
{
	typedef long long clientTime;
	long long sysTime = 0;
	queue<clientTime> readyQ[4],processQ[3];
	REP(i,n) readyQ[0].push(reachTime[i]);
	while(true)
	{
		bool modify = false;
		long long nextSysTime = 1LL<<60;
		for(int i=3;i>0;i--)
		{
			while(!processQ[i-1].empty()&&processQ[i-1].front()+t[i-1]<=sysTime)
			{
				modify = true;
				readyQ[i].push(processQ[i-1].front()+t[i-1]);
				processQ[i-1].pop();
			}
			if(!modify&&!processQ[i-1].empty())
			{
				nextSysTime = min(nextSysTime,processQ[i-1].front()+t[i-1]);
			}
		}
		REP(i,3)
		{
			while(processQ[i].size()<k[i]&&!readyQ[i].empty()&&readyQ[i].front()<=sysTime)
			{
				modify = true;
				processQ[i].push(sysTime);
				readyQ[i].pop();
			}
			if(!modify&&processQ[i].size()<k[i]&&!readyQ[i].empty())
			{
				nextSysTime = min(nextSysTime,readyQ[i].front());
			}
		}
		if(!modify)
		{
			sysTime = nextSysTime;
			continue;
		}
		if(readyQ[3].size()==n) break;
		sysTime++;
	}
	long long ans = -1;
	REP(i,n)
	{
		if(readyQ[3].front()-reachTime[i]>ans) ans = readyQ[3].front()-reachTime[i];
		readyQ[3].pop();
	}
	cout<<ans<<endl;
}
int main()
{
	//freopen("data.txt","r",stdin);
	REP(i,3) cin>>k[i];
	REP(i,3) cin>>t[i];
	cin>>n;
	REP(i,n) scanf("%d",reachTime+i);
	slove();
	return 0;
}
